package ${package.ServiceImpl};


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import com.yc.framework.baseClass.R;


/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */

@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity},${entity}Example>(), ${table.serviceName} {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName},${entity}> implements ${table.serviceName} {

    /**
    * 分页查询实体列表
    * @param model 查询参数
    * @return 查询结果
    */
    @Override
    public R list( ${entity} model){
        IPage<${entity}> page = new Page<>(model.getPageNum(),model.getPageSize());
        QueryWrapper<${entity}> wrapper = new QueryWrapper<>();
         initCondition(wrapper);
        setParam(wrapper,model);
         IPage<${entity}> px = page(page,wrapper);
        return R.ok().put("data",px.getRecords()).put("total", px.getTotal());
    }

    /**
    * 根据主键删除实体对象，返回值封装成R，若成功则会把要删除的主键计入返回的R
    *
    * @param id 主键
    * @return 删除是否成功
   
    @Override
    public R removeModelById(String id){
        ${entity} model=new ${entity}();
        model.setId(id);
        return removeModelById(model);
    }
 */
    public  void setParam(QueryWrapper<${entity}> wrapper, ${entity} model) {
        if (model == null) {
        return;
        }
       // wrapper.eq("deleted", false);
    }
}
</#if>